<?php

use App\Http\Controllers\Admin\Category;
use App\Http\Controllers\Admin\Coupon;
use App\Http\Controllers\Admin\Courses;
use App\Http\Controllers\Admin\Index;
use App\Http\Controllers\Admin\Login;
use App\Http\Controllers\Admin\Oss;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\Swiper;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['middleware'=>'Login'],function (){
    Route::get('admin/index',[Index::class,'index']);
    Route::get('admin/welcome',[Index::class,'welcome']);
    Route::get('admin/logout',[Login::class,'logout']);

    //资源路由
    Route::resource("admin/swiper","\App\Http\Controllers\Admin\Swiper");

    //获取幻灯片数据
    Route::get("admin/getSwiper",[Swiper::class,"getSwiper"]);

    //图片上传
    Route::post("admin/swiper/upload",[Swiper::class,'upload']);

    //分类  资源路由
    Route::resource("admin/category","\App\Http\Controllers\Admin\Category");

    //获取分类数据
    Route::get("admin/getCates",[Category::class,"getCates"]);


    //课程  资源路由
    Route::resource("admin/course","\App\Http\Controllers\Admin\Courses");

    //获取课程数据
    Route::get("admin/getCourses",[Courses::class,"getCourses"]);

    //添加课程章节
    Route::get("admin/course/catlog/{id}",[Courses::class,"catlog"]);

    //添加课程章标题
    Route::post('admin/course/saveChapter',[Courses::class,"saveChapter"]);

    //添加课程章节视频
    Route::post('admin/course/saveVideo',[Courses::class,"saveVideo"]);

    //优惠券
    Route::resource('admin/coupon',"\App\Http\Controllers\Admin\Coupon");

    //获取优惠券
    Route::get("admin/getCoupons",[Coupon::class,"getCoupons"]);


});

Route::get('admin/login',[Login::class,'index']);
Route::post('admin/login',[Login::class,'login']);

Route::get("/admin/oss/getSign",[Oss::class,'getSign']);
Route::post("/admin/oss/callBack",[Oss::class,'callBack']);

Route::get('/',function (){
    return "111";
});

